import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UserModule } from './user/user.module';
import { MenuModule } from './menu/menu.module';
import { DictionaryModule } from './dictionary/dictionary.module';
import { UploadModule } from './upload/upload.module';
import { CacheModule } from './cache/cache.module';
import { AddonModule } from './addon/addon.module';
@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: 'localhost',
      port: 33060,
      username: 'root',
      password: 'root',
      database: 'project_api',
      entities: [__dirname + '/**/*.entity{.ts,.js}'],
      synchronize: true,
      retryAttempts: 3, // 增加重试次数
      retryDelay: 2000, // 重试间隔（毫秒）
      logging: ['error', 'warn'],
      // autoLoadEntities: true,
    }),
    UserModule,
    MenuModule,
    DictionaryModule,
    UploadModule,
    CacheModule,
    AddonModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule { }
